from selenium import webdriver
from time import sleep

from selenium.webdriver.common.by import By

browser = webdriver.Chrome()
browser.get("https://kaijiang.500.com/shtml/dlt/21115.shtml")
sleep(3)
browser.set_window_size(1400, 800)
print(browser)
kaijiang_url_list = []
element = browser.find_element(By.CLASS_NAME,'iSelectList').find_elements(By.TAG_NAME,'a')
for i in range(15):
    link = element[i].get_attribute('href')
    kaijiang_url_list.append(link)
print(kaijiang_url_list)


def loop_get_rewoard_num():
    for i in range(len(kaijiang_url_list)):
        url = kaijiang_url_list[i]
        browser.get(url)
        sleep(3)
        zhongjiang = browser.execute_script('return document.querySelectorAll(".kj_tablelist02 td>table tr>td")')
        print(zhongjiang[3].text)


loop_get_rewoard_num()
browser.quit()
